package com.sjht.android.bxgz.network;

import java.util.HashMap;
import java.util.Map;

public class RequestEntity {
	private static final String ACCEPT = "application/vnd.wap.xhtml+xml,application/xml,text/vnd.wap.wml,text/html,application/xhtml+xml,image/jpeg;q=0.5,image/png;q=0.5,image/gif;q=0.5,image/*;q=0.6,video/*,audio/*,*/*;q=0.6";
	private static final String ACCEPT_ENCODING = "gzip,deflate";
	private static final String CONNECTION = "Close";
	private static final String MODEL = android.os.Build.MODEL;
	private static final String VERSION_RELEASE = android.os.Build.VERSION.RELEASE;
	private static final String USER_AGENT = MODEL + "~" + VERSION_RELEASE;
	
	public static final byte METHOD_GET = 1;
	public static final byte METHOD_POST = 2;
	
	private String mUrl;
	//1代表get， 2代表post
	private byte mMethod;

	private HashMap<String, String> mHeaderMap;
	private HashMap<String, String> mParamsMap;

	public RequestEntity() {
		mHeaderMap = new HashMap<String, String>();
		mParamsMap = new HashMap<String, String>();
		// 缺省 header
		addHeader(HttpHeader.REQ.ACCEPT, ACCEPT);
		addHeader(HttpHeader.REQ.ACCEPT_ENCODING, ACCEPT_ENCODING);
		addHeader(HttpHeader.REQ.CONNECTION, CONNECTION);
		addHeader(HttpHeader.REQ.USER_AGENT, USER_AGENT);
		addHeader(HttpHeader.REQ.VERSION_RELEASE, VERSION_RELEASE);//手机系统版本
		addHeader(HttpHeader.REQ.MODEL, MODEL);//手机型号
		
	}

	public String getUrl() {
		return this.mUrl;
	}

	public void setUrl(String url) {
		this.mUrl = url;
	}

	public void setMethod(byte method) {
		this.mMethod = method;
	}

	public byte getMethod() {
		return this.mMethod;
	}

	public void addParam(String name, String value) {
		mParamsMap.put(name, value);
	}

	public String getParam(String name) {
		return mParamsMap.get(name);
	}

	public void removeParam(String name) {
		mParamsMap.remove(name);
	}

	public Map<String, String> getParams() {
		return this.mParamsMap;
	}
	
	public void addHeader(String name, String value) {
		mHeaderMap.put(name, value);
	}

	public void getHeader(String name) {
		mHeaderMap.get(name);
	}

	public void removeHeader(String name) {
		mHeaderMap.remove(name);
	}
	
	public Map<String, String> getHeaders() {
		return this.mHeaderMap;
	}

}
